home *** CD-ROM | disk | FTP | other *** search
- global gstepcounter, gmedialist, gWriteObject, gFTindexS, gdontfind1, gAlphText, gtheText, gAlphTextNew, glTheProp, gTextIndexA, gShortLongName, gReadObject, gEntireNameList, gGlobalStepCount, gdontfind3, gdontfind2, gLocalStepCount
-
- on hTestEntryNamesMatch
- set vtempList to [:]
- set hold to []
- set vCurrentList to [:]
- set gEntireNameList to [:]
- repeat with vCountCastMem = 513 to 540
- set vtempList to the text of cast vCountCastMem
- set vtempList to value(vtempList)
- repeat with p = 1 to count(vtempList)
- addProp(gEntireNameList, getPropAt(vtempList, p), getAt(vtempList, p))
- end repeat
- end repeat
- set gEntireNameList to value(gEntireNameList)
- sort(gEntireNameList)
- set vCurrentList to value(vCurrentList)
- sort(vCurrentList)
- repeat with vCountCastMem = 663 to 782
- set vCurrentList to the text of cast vCountCastMem
- set vCurrentList to value(vCurrentList)
- sort(vCurrentList)
- set maxcount to count(vCurrentList)
- set entryname to hChangeOneEntry(getPropAt(vCurrentList, 1), gEntireNameList)
- repeat with n = 2 to maxcount
- set entryname to hChangeOneEntry(getPropAt(vCurrentList, n), gEntireNameList)
- end repeat
- end repeat
- end
-
- on buildwordlist pStartAttrib, pEndAttrib, pName, pThisAEpis, pFresh
- hputmsg("buildwordlist>******** Build Full Text Index")
- set vBeginShortCastMem to the number of cast "LU_A_ENCY"
- set vEndShortCastMem to the number of cast "LU_Z_ENCY"
- set vtempList to [:]
- set hold to []
- set vCurrentList to [:]
- set gEntireNameList to [:]
- setupFTindexS()
- if pFresh = 0 then
- set gFTindexS to hReadInList(pName)
- end if
- sort(gFTindexS)
- set gEntireNameList to hMakeListFromCast(vBeginShortCastMem, vEndShortCastMem)
- set gEntireNameList to value(gEntireNameList)
- if pThisAEpis = 1 then
- set gEntireNameList to hThisIsAnEpisGuideVal(gEntireNameList)
- end if
- if voidp(gEntireNameList) then
- hputmsg("this list is messedup")
- end if
- sort(gEntireNameList)
- set vCurrentList to value(vCurrentList)
- sort(vCurrentList)
- repeat with vCountCastMem = pStartAttrib to pEndAttrib
- set vCurrentList to the text of cast vCountCastMem
- set vCurrentList to value(vCurrentList)
- sort(vCurrentList)
- put getPropAt(vCurrentList, 1) into field "searchtextcandidate"
- hMiniFind()
- hscanforwords()
- repeat with n = 2 to count(vCurrentList)
- hStepNext()
- hscanforwords()
- end repeat
- hAlphWrite(pName)
- end repeat
- put "FINISHED"
- end
-
- on setupFTindexS
- hputmsg("******** setup the global full text list")
- set gFTindexS to [:]
- sort(gFTindexS)
- initexclusionlist1()
- initexclusionlist2()
- end
-
- on hTestAttForShortNames pATTBEGIN, pATTEND
- set vBeginShortCastMem to the number of cast "LU_A_ENCY"
- set vEndShortCastMem to the number of cast "LU_Z_ENCY"
- set vLUlist to hMakeListFromCast(vBeginShortCastMem, vEndShortCastMem)
- set vTheseareMissing to hSpitOutShortNames(pATTBEGIN, pATTEND, vLUlist)
- hputmsg(RETURN)
- writeIt(string(vTheseareMissing), "MISSING.TXT")
- hputmsg(vTheseareMissing)
- end
-
- on hSpitOutShortNames pBegin, pend, pList
- hputmsg(">hSpitOutShortNames begins.")
- set vMissingList to []
- set pList to value(pList)
- repeat with vCountCastMem = pBegin to pend
- set vAttList to value(the text of cast vCountCastMem)
- repeat with x = 1 to count(vAttList)
- set vLongName to getPropAt(vAttList, x)
- set vPos to getPos(pList, vLongName)
- if vPos <> 0 then
- set vHereIstheShortName to getPropAt(pList, vPos)
- hputmsg("O.K.")
- next repeat
- end if
- addAt(vMissingList, vLongName)
- hputmsg(RETURN & "hSpitOutShortNames > MISSING>" && vLongName)
- end repeat
- put vMissingList
- end repeat
- hputmsg("done.")
- put vMissingList
- return vMissingList
- end
-
- on hAlphWrite thisname
- set gAlphText to [:]
- set gtheText to [:]
- repeat with p = charToNum("A") to charToNum("Z")
- set gtheText to gFTindexS
- sort(gtheText)
- set vstartHere to numToChar(p)
- set vendHere to numToChar(p + 1)
- repeat with n = findPosNear(gtheText, vstartHere) to findPosNear(gtheText, vendHere) - 1
- addProp(gAlphText, getPropAt(gtheText, n), getAt(gtheText, n))
- end repeat
- writeIt(gAlphText, thisname & numToChar(p))
- set gAlphText to [:]
- end repeat
- end
-
- on writeIt thisString, thisname
- set gtheText to [:]
- set gWriteObject to FileIO(mnew, "write", the pathName & thisname)
- set gtheText to thisString
- set newText to value(gtheText)
- set reallyText to string(newText)
- gWriteObject(mWriteString, reallyText)
- gWriteObject(mdispose)
- hputmsg("Wrote a file named " & thisname & "******************" & RETURN)
- end
-
- on hReadIt thisname
- set gTheFile to [:]
- set gReadObject to FileIO(mnew, "read", the pathName & thisname)
- hputmsg("the pathname&thisName =" & the pathName & thisname)
- set gTheFile to gReadObject(mReadLine)
- gReadObject(mdispose)
- hputmsg("Read a file named " & thisname & "******************" & RETURN)
- return gTheFile
- end
-
- on hscanforwords
- set entryname to the text of field "searchtextcandidate"
- hputmsg("the entryname is" && entryname)
- set nextword to EMPTY
- set Wrdnum to 1
- set listed to 0
- set maxwrds to the number of words in field "F1"
- set entryname to hChangeOneEntry(entryname, gEntireNameList)
- hputmsg("after entryname =" && entryname)
- repeat while Wrdnum <= maxwrds
- set nextword to hZapped(word Wrdnum of field "F1")
- set vFirstChar to hCapitalize(chars(nextword, 1, 1))
- set nextword to vFirstChar & chars(nextword, 2, length(nextword))
- if not getOne(gdontfind1, nextword) then
- if not getOne(gdontfind2, nextword) then
- set currvalue to getaProp(gFTindexS, nextword)
- if not voidp(currvalue) then
- set prevlist to getaProp(currvalue, entryname)
- if not voidp(prevlist) then
- put "," & Wrdnum after prevlist
- setProp(currvalue, entryname, prevlist)
- else
- addProp(currvalue, entryname, Wrdnum)
- end if
- setProp(gFTindexS, nextword, currvalue)
- else
- set templist to [:]
- setaProp(templist, entryname, Wrdnum)
- addProp(gFTindexS, nextword, templist)
- end if
- end if
- end if
- set Wrdnum to Wrdnum + 1
- set listed to 0
- end repeat
- end
-
- on hZapped x
- if voidp(x) then
- return
- end if
- set x to hZapThroughOut(x, 40)
- set x to hZapThroughOut(x, 91)
- set x to hZapThroughOut(x, 41)
- set x to hZapThroughOut(x, 93)
- set x to hZapThroughOut(x, 59)
- set x to hZapThroughOut(x, 58)
- set x to hZapBegin(x, 32)
- set x to hZapBegin(x, 210)
- set x to hZapBegin(x, 39)
- set x to hZapBegin(x, 45)
- set x to hZapBegin(x, 212)
- set x to hZapEnd(x, 32)
- set x to hZapEnd(x, 211)
- set x to hZapEnd(x, 44)
- set x to hZapEnd(x, 46)
- set x to hZapEnd(x, 39)
- set x to hZapEnd(x, 213)
- set x to hZapEnd(x, 33)
- set x to hZapEnd(x, 63)
- set x to hZapSpecialCase(x)
- return x
- end
-
- on hZapSpecialCase vEntry
- if charToNum(char length(vEntry) - 1 of vEntry) = 213 then
- if charToNum(char length(vEntry) of vEntry) = 115 then
- delete char length(vEntry) of vEntry
- delete char length(vEntry) of vEntry
- end if
- end if
- return vEntry
- end
-
- on hSaveProperties
- set hold to []
- repeat with n = 1 to count(gFTindexS)
- set vhold to getPropAt(gFTindexS, n)
- append(hold, vhold)
- end repeat
- return hold
- end
-
- on hReadInList vFileName
- set gShortLongName to [:]
- set gEntireNameList to [:]
- repeat with vVar = charToNum("A") to charToNum("Z")
- set vVarChar to numToChar(vVar)
- set gShortLongName to hReadIt(vFileName & vVarChar)
- set gShortLongName to value(gShortLongName)
- if not objectp(gShortLongName) then
- end if
- set p to 1
- repeat with p = p to count(gShortLongName)
- addProp(gEntireNameList, getPropAt(gShortLongName, p), getAt(gShortLongName, p))
- end repeat
- end repeat
- return gEntireNameList
- end
-
- on hReadInEntry vFileName, list
- set vShortLongName to [:]
- set vShortLongName to hReadIt(vFileName)
- set vShortLongName to value(vShortLongName)
- if not objectp(vShortLongName) then
- end if
- repeat with p = 1 to count(vShortLongName)
- addProp(list, getPropAt(vShortLongName, p), getAt(vShortLongName, p))
- end repeat
- return list
- end
-
- on hChangeOneEntry vEntryName, vthisList
- set vthisList to value(vthisList)
- set vFindWhere to getPos(vthisList, vEntryName)
- if vFindWhere <> 0 then
- hputmsg(">hChangeOneEntry got pos =" && vFindWhere && "for" && vEntryName)
- set vValue to getPropAt(vthisList, vFindWhere)
- else
- set vValue to hMakeEmergencySrtNm(vEntryName)
- end if
- return vValue
- end
-
- on hMakeEmergencySrtNm pNtryNm
- set vCleanLongName to hZapMod(pNtryNm)
- set vLength to length(vCleanLongName)
- set vShortName to "X" & char 1 to 3 of vCleanLongName & char vLength - 1 to vLength of vCleanLongName
- if length(vShortName) < 6 then
- set vDiff to 6 - length(vShortName)
- repeat with n = 1 to vDiff
- set vAdd to vAdd & "_"
- end repeat
- set vShortName to vShortName & vAdd
- end if
- hputmsg("YO! we made •>" & vShortName & "<• out of " & pNtryNm)
- if hFileIsHere(the pathName & "New Short Names") then
- set vL to hReadIt("New Short Names")
- end if
- set vL to vL & vShortName & ":" & pNtryNm & ", "
- hputmsg("Sending" && vL && "to file.")
- hWriteFile(vL, "New Short Names")
- return vShortName
- end
-
- on hWriteFile pthisString, pthisName
- set vWriteObject to FileIO(mnew, "write", the pathName & pthisName)
- vWriteObject(mWriteString, pthisString)
- vWriteObject(mdispose)
- hputmsg("Wrote a file named " & pthisName & RETURN)
- end
-
- on hZapMod pN
- if voidp(pN) then
- return
- end if
- set pN to hZapThroughOut(pN, 40)
- set pN to hZapThroughOut(pN, 91)
- set pN to hZapThroughOut(pN, 41)
- set pN to hZapThroughOut(pN, 93)
- set pN to hZapThroughOut(pN, 59)
- set pN to hZapThroughOut(pN, 58)
- set pN to hZapThroughOut(pN, 32)
- set pN to hZapThroughOut(pN, 210)
- set pN to hZapThroughOut(pN, 39)
- set pN to hZapThroughOut(pN, 45)
- set pN to hZapThroughOut(pN, 212)
- set pN to hZapThroughOut(pN, 211)
- set pN to hZapThroughOut(pN, 44)
- set pN to hZapThroughOut(pN, 46)
- set pN to hZapThroughOut(pN, 39)
- set pN to hZapThroughOut(pN, 213)
- set pN to hZapThroughOut(pN, 33)
- set pN to hZapThroughOut(pN, 63)
- set pN to hZapThroughOut(pN, 142)
- set pN to hZapThroughOut(pN, 137)
- set pN to hZapSpecialCase(pN)
- return pN
- end
-